<template>
	<view>
		<template v-if="data">
		<view class="userListFor" v-for="(item,index) in data" :key='index'>
			<view class="userListStyle" @tap="toDetail(item)" >
				<view class="left">
					<text>负责人名字:<text class="color" style="padding-left: 10rpx;">{{item.handheld_terminal_person_in_charge}}</text></text>
					<text><text>联系电话：</text><text class="color">{{item.handheld_terminal_phone}}</text></text></view>
				<view class="right">
					<text>受理状态：<text>{{item.handheld_terminal_state>0?'已受理':'未受理'}}</text></text>
					<text class="color" style="font-size: 28rpx;">{{item.handheld_terminal_time}}</text>
				</view>
			</view>		
		</view>
		</template>
		<template v-else>
			<no-thing></no-thing>
		</template>
		<loadMore :loadtext="loadtext"></loadMore>
	</view>
</template>

<script>
	import noThing from"../../../../components/common/no-thing.vue"
	import loadMore from "../../../../components/common/load-more.vue"
	export default {
		components: {
			noThing,
			loadMore
		},
		data() {
			return {
				data:[],
				loadtext:"上拉加载更多",
				pagenum:1,
			};
		},
		onReady() {
			this.getEpidemicList();
		},
		//监听触底事件
		onReachBottom(){
			this.loadmore()
		},
		onNavigationBarButtonTap() {
			uni.navigateTo({
				url:"../epidemicReport"
			})
		},
		methods:{
			//查看详情
			toDetail(item){
				// console.log(item)
				uni.setStorageSync('epidemicDetail',item);
				uni.navigateTo({
					url:"./epidemiDetails?item="+item
				})
			},
			//获取历史上传
			getEpidemicList() {
				// console.log(this.User.userInfo.farm_id)
				uni.request({
					url: this.confige.webUrl + "/epidemic/listEpidemic",
					data: {
						limits:15,
						pages:1
					},
					header: {
						'X-Token': this.User.token
					},
					success: (res) => {
						console.log(res)
						if(!res.data.result){
							this.loadtext ="没有更多了";
							return;
						}
						this.data = res.data.result[0].list;
						if(this.data.length>14){
							this.loadtext ="上拉加载更多";
						}
						else{
							this.loadtext ="没有更多了";
						}
					}
				})
			},
			loadmore(){
			   if(this.loadtext!="上拉加载更多"){ return;}
			   this.loadtext="加载中...";	
			   this.pagenum++;
			   setTimeout(() => {
				uni.request({
					url: this.confige.webUrl + "/epidemic/listEpidemic",
					data:{
						limits:15,
						pages:this.pagenum
					},
					header:{
						'X-Token':this.User.token
					},
					success: (res) => {
						console.log(res)
						
						 if(res.data.code==200){
							 let list = res.data.result[0].list;
							 this.userTalkList.push(...list) ;
							this.loadtext="上拉加载更多"
						 }
						 else{
						 	this.loadtext="没有更多啦"
						     }
					 }	
					}	  
				)}, 1000);
			},
		}
	}
</script>

<style lang="less">
  @import "../../../../common/global.less";
  .color{ color: #a5a5a5;}
  .ed{color: ;}
  .left{
	  display: flex;
	  justify-content: center;
	  flex-direction: column;
	  font-size: 30rpx;
	  padding-left: 10rpx;
  }
  .right{
	  display: flex;
	  justify-content: center;
	  // align-items:flex-end;
	  flex-direction: column;
	  font-size: 30rpx;
  }
  page{ background-color: @backcolorthree;}
 .userListFor{
 	position: relative;
 width:90%;
 margin: auto; }
 // .title {min-width: calc(4em + 15px);}
 .userListStyle{ 
 display: flex;
 flex-direction:row;
 align-items: center;
 >view:nth-of-type(1){ width: 60%;}
 >view:nth-of-type(2){ width: 40%; }
 flex-direction:row;
 font-size: 35rpx;
 height: 160rpx;	
 margin-top: 20rpx;
 background-color: #FFFFFF;
 border-radius: 20rpx;
 box-shadow:1px 1px 1px 1px #eeeeee;
 
 }
</style>
